package file;

import java.io.File;
import java.io.FileFilter;


public class ListFileDome2 {
    public static void main(String[] args) {
        File file = new File("./");

            FileFilter fileFilter = new FileFilter() {
                public boolean accept(File file1) {
                    String name = file1.getName();
                    return name.endsWith(".txt");
                }
            };
            File[] files = file.listFiles(fileFilter);
            System.out.println(files.length);
            for (File fil : files) {
                System.out.println(fil.getName());
            }
        }
    }

